
interface Pursue {
    String getName();
    String getTargetName();
    String giveFlower(boolean returnFlags);
    String giveChocolate(boolean returnFlags);
}

class Girl {
    private String name;

    public Girl(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }
}

class Boy implements Pursue {
    private String name;
    private Girl target;

    public Boy(String name, Girl target) {
        this.name = name;
        this.target = target;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public String getTargetName() {
        return target.getName();
    }

    @Override
    public String giveFlower(boolean returnFlags) {
        String out = "送你的99朵玫瑰";
        if (!returnFlags) {
            System.out.printf("%s 这是我%s\n", target.getName(), out);
        }
        return out;
    }

    @Override
    public String giveChocolate(boolean returnFlags) {
        String out = "送你的德芙";
        if (!returnFlags) {
            System.out.printf("%s 这是我%s\n", target.getName(), out);
        }
        return out;
    }
}


class Proxy implements Pursue {
    Pursue proxyObj;

    public Proxy(Pursue proxyObj) {
        this.proxyObj = proxyObj;
    }

    @Override
    public String getName() {
        return "代理";
    }

    @Override
    public String getTargetName() {
        return proxyObj.getTargetName();
    }

    @Override
    public String giveFlower(boolean returnFlags) {
        String s = String.format("%s , 这是 %s %s", proxyObj.getTargetName(),
                                proxyObj.getName(),
                                proxyObj.giveFlower(true));
        if (!returnFlags)
            System.out.println(s);
        return s;
    }

    @Override
    public String giveChocolate(boolean returnFlags) {
        if ("张三".equals(proxyObj.getName()))
            return "";

        String s = String.format("%s , 这是 %s %s", proxyObj.getTargetName(),
                                proxyObj.getName(),
                                proxyObj.giveChocolate(true));
        if (!returnFlags)
            System.out.println(s);
        return s;
    }
}

public class StaticProxyTest {
    static public void main(String [] args) {
        Pursue p = new Proxy(new Boy("张三", new Girl("娇娇")));
        p.giveFlower(false);
        p.giveChocolate(false);

        Pursue pp = new Proxy(p);
        pp.giveFlower(false);
        pp.giveChocolate(false);
    }
}
